package com.anis.project.medcare.editors.input;

import java.util.Date;
import java.util.List;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IPersistableElement;

import com.anis.jpa.medical.model.MedicalReport;
import com.anis.jpa.medical.model.Patient;

public class PatientEditorInput implements IEditorInput {
	Patient patient;
	private byte[] patientImageByte;

	public PatientEditorInput(Patient patient) {
		this.patient = patient;
	}

	@Override
	public Object getAdapter(Class adapter) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean exists() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public ImageDescriptor getImageDescriptor() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getName() {
		if (patient != null)
			return patient.getPatientname();
		else
			return "";
	}

	@Override
	public IPersistableElement getPersistable() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getToolTipText() {
		if (patient != null)
			return patient.getPatientname();
		else
			return "";
	}

	public String getPatientName() {
		if (patient != null && patient.getPatientname() != null)
			return patient.getPatientname();
		else
			return "";
	}

	public String getPatientLastName() {
		if (patient != null && patient.getPatientlastname() != null)
			return patient.getPatientlastname();
		else
			return "";
	}

	public List<MedicalReport> getReportList() {
		if (patient != null && patient.getMedicalReports() != null)
			return patient.getMedicalReports();
		else
			return null;
	}

	public String getPatientPhone() {
		return patient == null ? ""
				: String.valueOf(patient.getPhone()) == null ? "" : String
						.valueOf(patient.getPhone());
	}

	public Patient getPatient() {
		return this.patient;
	}

	public String getPatientTitle() {
		return patient == null ? "" : patient.getPatienttitle() == null ? ""
				: patient.getPatienttitle();
	}

	public String getPatientAddress() {
		return patient == null ? "" : patient.getPatientaddress() == null ? ""
				: patient.getPatientaddress();
	}

	public String getPatientID() {
		return patient == null ? null : patient.getpatientID() == null ? null
				: patient.getpatientID();
	}

	public String getPatientGender() {
		return patient == null ? "" : patient.getPatientsex() == null ? ""
				: patient.getPatientsex();
	}

	public Date getPatientBirthDay() {
		return patient == null ? null : patient.getBirthDay() == null ? null
				: patient.getBirthDay();
	}

	public Date getPatientCreationDate() {
		return patient == null ? null
				: patient.getPatientCreationdate() == null ? null : patient
						.getPatientCreationdate();
	}

	public void setPatientTitle(String title) {
		this.patient.setPatienttitle(title);
	}

	public void setPatientName(String patientName) {
		patient.setPatientname(patientName);
	}

	public void setPatientGender(String patientGender) {
		this.patient.setPatientsex(patientGender);
	}

	public void setPatientPhone(Integer patientPhone) {
		if (patientPhone != null)
			this.patient.setPhone(patientPhone);
	}

	public void setPatientLastName(String lastName) {
		this.patient.setPatientlastname(lastName);
	}

	public void setPatientAddress(String patientAddress) {
		this.patient.setPatientaddress(patientAddress);
	}

	public void setPatientBirthDay(Date patientBirthDay) {
		this.patient.setPatientBirthday(patientBirthDay);
	}

	public String getPatientCnamID() {
		return patient == null ? ""
				: String.valueOf(patient.getCnamID()) == null ? "" : String
						.valueOf(patient.getCnamID());
	}

	public void setPatientCnamID(long cnamID) {
		this.patient.setCnamID(cnamID);
	}

	public String getPatientCnamType() {
		return patient == null ? "" : patient.getCnamType() == null ? ""
				: patient.getCnamType();
	}

	public void setPatientCnamType(String cnamType) {
		this.patient.setCnamType(cnamType);
	}

	public String getPatientUsefullNotes() {
		return patient == null ? null
				: patient.getpatientUsefullNotes() == null ? "" : patient
						.getpatientUsefullNotes();
	}

	public void setPatientUsefullNotes(String useFullNotes) {
		this.patient.setpatientUseFullNotes(useFullNotes);
	}

	public String getPatientNextAppointement() {
		return patient == null ? null : patient.getrdvDate() == null ? null
				: patient.getrdvDate();
	}

	public void setPatientNextAppointement(String date) {
		this.patient.setrdvDate(date);

	}

	public byte[] getPatientImage() {
		return null;
	}

	public void setPatientImage(byte[] imageByte) {
		this.patientImageByte = imageByte;
	}

	public Date getPatientCnamValidityDate() {
		return patient == null ? null
				: patient.getCnamValidityDate() == null ? null : patient
						.getCnamValidityDate();
	}

}
